% Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite

{\ttfamily \raggedright {
\noindent
\mbox{}\textbf{\textcolor{RoyalBlue}{\#define}}\ \textbf{\textcolor{Black}{MAX}}\textcolor{BrickRed}{(}a\textcolor{BrickRed}{,}b\textcolor{BrickRed}{)}\ \textcolor{BrickRed}{((}a\textcolor{BrickRed}{$>$}b\textcolor{BrickRed}{)?(}a\textcolor{BrickRed}{):(}b\textcolor{BrickRed}{))} \\
\mbox{}\textcolor{ForestGreen}{int}\ dp\textcolor{BrickRed}{[}\textcolor{Purple}{1001}\textcolor{BrickRed}{][}\textcolor{Purple}{1001}\textcolor{BrickRed}{];} \\
\mbox{} \\
\mbox{}\textcolor{ForestGreen}{int}\ \textbf{\textcolor{Black}{lcs}}\textcolor{BrickRed}{(}\textbf{\textcolor{Blue}{const}}\ string\ \textcolor{BrickRed}{\&}s\textcolor{BrickRed}{,}\ \textbf{\textcolor{Blue}{const}}\ string\ \textcolor{BrickRed}{\&}t\textcolor{BrickRed}{)}\textcolor{Red}{\{} \\
\mbox{}\ \ \textcolor{ForestGreen}{int}\ m\ \textcolor{BrickRed}{=}\ s\textcolor{BrickRed}{.}\textbf{\textcolor{Black}{size}}\textcolor{BrickRed}{(),}\ n\ \textcolor{BrickRed}{=}\ t\textcolor{BrickRed}{.}\textbf{\textcolor{Black}{size}}\textcolor{BrickRed}{();} \\
\mbox{}\ \ \textbf{\textcolor{Blue}{if}}\ \textcolor{BrickRed}{(}m\ \textcolor{BrickRed}{==}\ \textcolor{Purple}{0}\ \textcolor{BrickRed}{$|$$|$}\ n\ \textcolor{BrickRed}{==}\ \textcolor{Purple}{0}\textcolor{BrickRed}{)}\ \textbf{\textcolor{Blue}{return}}\ \textcolor{Purple}{0}\textcolor{BrickRed}{;} \\
\mbox{}\ \ \textbf{\textcolor{Blue}{for}}\ \textcolor{BrickRed}{(}\textcolor{ForestGreen}{int}\ i\textcolor{BrickRed}{=}\textcolor{Purple}{0}\textcolor{BrickRed}{;}\ i\textcolor{BrickRed}{$<$=}m\textcolor{BrickRed}{;}\ \textcolor{BrickRed}{++}i\textcolor{BrickRed}{)} \\
\mbox{}\ \ \ \ dp\textcolor{BrickRed}{[}i\textcolor{BrickRed}{][}\textcolor{Purple}{0}\textcolor{BrickRed}{]}\ \textcolor{BrickRed}{=}\ \textcolor{Purple}{0}\textcolor{BrickRed}{;} \\
\mbox{}\ \ \textbf{\textcolor{Blue}{for}}\ \textcolor{BrickRed}{(}\textcolor{ForestGreen}{int}\ j\textcolor{BrickRed}{=}\textcolor{Purple}{1}\textcolor{BrickRed}{;}\ j\textcolor{BrickRed}{$<$=}n\textcolor{BrickRed}{;}\ \textcolor{BrickRed}{++}j\textcolor{BrickRed}{)} \\
\mbox{}\ \ \ \ dp\textcolor{BrickRed}{[}\textcolor{Purple}{0}\textcolor{BrickRed}{][}j\textcolor{BrickRed}{]}\ \textcolor{BrickRed}{=}\ \textcolor{Purple}{0}\textcolor{BrickRed}{;} \\
\mbox{}\ \ \textbf{\textcolor{Blue}{for}}\ \textcolor{BrickRed}{(}\textcolor{ForestGreen}{int}\ i\textcolor{BrickRed}{=}\textcolor{Purple}{0}\textcolor{BrickRed}{;}\ i\textcolor{BrickRed}{$<$}m\textcolor{BrickRed}{;}\ \textcolor{BrickRed}{++}i\textcolor{BrickRed}{)} \\
\mbox{}\ \ \ \ \textbf{\textcolor{Blue}{for}}\ \textcolor{BrickRed}{(}\textcolor{ForestGreen}{int}\ j\textcolor{BrickRed}{=}\textcolor{Purple}{0}\textcolor{BrickRed}{;}\ j\textcolor{BrickRed}{$<$}n\textcolor{BrickRed}{;}\ \textcolor{BrickRed}{++}j\textcolor{BrickRed}{)} \\
\mbox{}\ \ \ \ \ \ \textbf{\textcolor{Blue}{if}}\ \textcolor{BrickRed}{(}s\textcolor{BrickRed}{[}i\textcolor{BrickRed}{]}\ \textcolor{BrickRed}{==}\ t\textcolor{BrickRed}{[}j\textcolor{BrickRed}{])} \\
\mbox{}\ \ \ \ \ \ \ \ dp\textcolor{BrickRed}{[}i\textcolor{BrickRed}{+}\textcolor{Purple}{1}\textcolor{BrickRed}{][}j\textcolor{BrickRed}{+}\textcolor{Purple}{1}\textcolor{BrickRed}{]}\ \textcolor{BrickRed}{=}\ dp\textcolor{BrickRed}{[}i\textcolor{BrickRed}{][}j\textcolor{BrickRed}{]+}\textcolor{Purple}{1}\textcolor{BrickRed}{;} \\
\mbox{}\ \ \ \ \ \ \textbf{\textcolor{Blue}{else}} \\
\mbox{}\ \ \ \ \ \ \ \ dp\textcolor{BrickRed}{[}i\textcolor{BrickRed}{+}\textcolor{Purple}{1}\textcolor{BrickRed}{][}j\textcolor{BrickRed}{+}\textcolor{Purple}{1}\textcolor{BrickRed}{]}\ \textcolor{BrickRed}{=}\ \textbf{\textcolor{Black}{MAX}}\textcolor{BrickRed}{(}dp\textcolor{BrickRed}{[}i\textcolor{BrickRed}{+}\textcolor{Purple}{1}\textcolor{BrickRed}{][}j\textcolor{BrickRed}{],}\ dp\textcolor{BrickRed}{[}i\textcolor{BrickRed}{][}j\textcolor{BrickRed}{+}\textcolor{Purple}{1}\textcolor{BrickRed}{]);} \\
\mbox{}\ \ \textbf{\textcolor{Blue}{return}}\ dp\textcolor{BrickRed}{[}m\textcolor{BrickRed}{][}n\textcolor{BrickRed}{];} \\
\mbox{}\textcolor{Red}{\}} \\

} \normalfont\normalsize
